<?php
/**
 * Data model
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 */
/**
 * Data model for table "scheduler"
 *
 * @category  DataModel
 * @package   DataModel
 * @author    DataModel Generator v1.3
 * @version   Revision: $Rev$
 *
 * @property-read mixed Id
 * @property-read mixed Task
 * @property-read mixed ProjectId
 * @property-read mixed Date
 * @property-read mixed State
 * @property-read mixed Result
 * @property-read mixed ResultPath
 * @property-read mixed Parsed
 */
abstract class BaseScheduler extends BaseRecord
{
    const TABLE_NAME = "scheduler";

    public function __construct()
    {
        parent::__construct(self::TABLE_NAME);
    }

    protected function initFields()
    {
        $this->hasColumn('id', 'PA:int(3)');
        $this->hasColumn('task', 'N:varchar(255)');
        $this->hasColumn('project_id', 'int(3)');
        $this->hasColumn('date', 'N:timestamp|CURRENT_TIMESTAMP');
        $this->hasColumn('state', 'N:tinyint(1)|0');
        $this->hasColumn('result', 'N:text');
        $this->hasColumn('result_path', 'varchar(255)');
        $this->hasColumn('parsed', 'tinyint(1)|0');
    }

    public function initRelations()
    {
        $this->addRelation('Project', new ORMRelationOne2One('Project', 'project_id', 'id'));
    }

    public function getById($id)
    {
        return parent::getById($id, 'Scheduler');
    }

    public function getByParams( $params, $type = ORMRecord::ONE_RECORD, $limit = null )
    {
        return parent::getByParams( $params, $type, $limit, 'Scheduler');
    }

    public function getAll( $limit = null )
    {
        return parent::getAll( $limit, 'Scheduler' );
    }
}